#include<iostream>
using namespace std;
void QuickSort(int* n,int start ,int end)
{
    int left = start;
    int right = end;
    int key = n[left];
    while(left < right)
    {
        while(n[right] >= key && left < right)
        {
            right--;
        }
        while(n[left] <= key && left <right)
        {
            left++;
        }
        if(left < right)
        {
            swap(n[left],n[right]);
        }
    }
    swap(n[start], n[left]);
    QuickSort(n, start, left - 1);
    QuickSort(n, left + 1, end);
}

int main()
{
    int n[10] = {10,20,30,98,92,65,49,21,9};
    QuickSort(n,0,9);
    for(auto e : n )
    {
        cout << e << " ";
    }
    
    return 0;
}